//Will Zepeda
//GSP-362
//Text.h
#pragma once
#include "DX include.h"

//font handler class
//must have a setAt(int x, int y) function
//so we can draw at any given location on the screen

//TODO: allocate buffer size			[X]
//	  : make class more VECTOR-like, 
//		not constantly allocating memory [X]
//	  : add functionality that coverts
//    : ints to char *'s and appends to
//	  : current mText.					[]
//	  : make color and alpha variables	[X]

class Text
{
private: //variables
	ID3DXFont*  mFont;
	TCHAR*		mText;
	RECT		mRect;
	int			mSize;
	D3DXCOLOR	mColor;

private: //functions

	//makes Text class behave like a managed array.
	void allocateBufferSize(char *, int);
	
	//reads in null terminated char buffer,
	//counts how big char buffer is,
	//if true, calls allocateBufferSize
	void checkArgSize(char *);

public:
	Text();//assigns default values and Arial font
	Text(char *);//@param char * lets you choose font u want
	/** 
	* param1: int == height in pixels
	* param2: bool == bold?
	* param3: bool == italisize?
	* param4: char* == name of font to use
	*/
	Text(int, bool, bool, char*);
	/*********************************/
	
	~Text();

	//sets position of rect top and left of rect
	//NOTE: rect right and bottom is SCREEN_WIDTH & SCREEN HEIGHT
	//    : font draws aligned to top & left
	void setPosition(int, int);

	//sets position of rect with left, top, 
	//sets size of rect with right and bottom
	//used to center text within a sprite/texture
	void setPosAndSize(int, int, int, int);

	void setText(char *);

	//sets color (red,green,blue,alpha);
	void setColor(int, int, int, int);
	
	void update();
	void render();
	//draws text vertically and horizontally centered within rect
	void renderCentered();
};